Repository navigation
test(tools): decode check_test_registration CLI output as UTF-8 - #13839
oneandonlydean merged 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
Reviewed — looks good
The explicit UTF-8 decoding matches the tool's UTF-8 output and fixes the test harness's locale-dependent read of that output.
What I ran
Reviewed head fe18b92006ec70131fbfe832828959f2c628559b against base 809c7fa2dfb1b21e2b31b3114b7d51bc14ee88ab; the merge preview was clean. Environment: Debian/Linux x86_64, Python 3.11.2. No build or compilation was needed.
python3 tools/pr_precheck.py --repo boykopovar/AnyPS5 --pr 13839 --output-dir /tmp/anyps5-pr-precheck/boykopovar-AnyPS5-pr-13839
python3 -m unittest tools.tests.test_test_registration
python3 tools/check_test_registration.py --scripts
python3 /tmp/anyps5-negative-control-13839.pyResults
| Check | Result |
|---|---|
| Diff check | Passed; no whitespace errors. |
| Conventions and PR template | Passed. |
| Python unit suite | 63 tests passed. |
| Test-script registration audit | 230 scripts accounted for. |
| Merge preview | Clean against 809c7fa2dfb1b21e2b31b3114b7d51bc14ee88ab. |
| Hosted eligibility, intake, labels | Passed. |
| Hosted conventions | Queued at the final snapshot. |
| Hosted Windows relinker and ASan | In progress at the final snapshot. |
| Hosted Ubuntu/macOS relinker jobs | Queued. |
| Hosted product Linux/Windows, register-context, write-watch | Skipped. |
| Test-quality helper | Could not run because the helper script was absent from the isolated precheck checkout. |
Unedited check output
All conventions checks passed.
...............................................................
----------------------------------------------------------------------
Ran 63 tests in 0.640s
OK
230 test script(s), each run by an add_test or a workflow
Negative control
| Assertion | Change tested | Did the old behavior fail? |
|---|---|---|
| The tool's UTF-8 error output can be read when the parent uses a Windows-style ANSI decoder. | Ran the unchanged CLI from the reviewed head with a Cyrillic temporary path; forced cp1252 decoding for the base behavior and UTF-8 decoding for the fix. |
Yes for the base behavior: UnicodeDecodeError on byte 0x81. The UTF-8 path returned the expected error (exit=2) without a traceback. |
This reproduces the decoding boundary on Linux; I did not run Windows locally. The precheck's automatic base-suite control passed under this host's UTF-8 locale, so it did not independently discriminate the platform-specific case. The author reports that the targeted base test fails and the PR test passes on Windows 11 with code page 1252.
Unedited negative-control output
base decode control: expected UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 247: character maps to <undefined>
UTF-8 control: exit=2; error line decoded; traceback absent
Sources
- The test helper now specifies UTF-8 at the reviewed head
- The CLI writes stdout and stderr as UTF-8 at the reviewed head
Not verified
I did not run on Windows or macOS. The Windows 11/code-page 1252 test results in the PR description are author-reported. The queued/in-progress hosted relinker jobs had not finished at the snapshot; they are separate from the locally run Python suite.
What
tools/check_test_registration.pyreconfigures stdout and stderr to UTF-8, butRegistrationTests.run_toolintools/tests/test_test_registration.pyreads its output withtext=True, which decodes with the locale encoding. On Windows without Python's UTF-8 mode, the locale encoding is the ANSI code page. When the temporary directory holds a character whose UTF-8 bytes the code page cannot decode, such asс(d1 81) in aTEMPlikeC:\Users\Иван\AppData\Local\Tempunder code page 1252, theerror:line naming the missingCMakeCache.txtfails to decode insubprocess's reader thread (UnicodeDecodeError: 'charmap' codec can't decode byte 0x81),stderrisNone, andtest_missing_build_directory_is_reported_without_a_tracebackraisesTypeError.run_toolnow passesencoding="utf-8". The tool is unchanged. Same kind of fix as #13833 and #13837 for theselect_tests,stubgenandcheck_skipstests.Tested
Windows 11, Python 3.14 (ANSI code page 1252), WinLibs GCC 15.2.0 UCRT POSIX SEH toolchain on
PATH.python tools/tests/test_test_registration.py RegistrationTests.test_missing_build_directory_is_reported_without_a_traceback RegistrationTests.test_unsupported_generator_is_reported_without_a_traceback(the tworun_toolusers):TEMPmainC:\b\l3 тестpython tools/tests/test_test_registration.pywith the defaultTEMP: 63 run, OK. WithC:\b\l3 тестthe CMake and Ninja cases still fail because the MinGW toolchain here cannot configure a build in a directory outside the ANSI code page; this change does not touch them.python tools/check_conventions.py --base origin/main: all checks passed.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code